package com.woupla.account;

import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;

import com.service.UserEJB;
import com.woupla.model.Customer;
import com.woupla.model.Employee;
import com.woupla.model.Manager;
import com.woupla.model.User;

import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author Dimitri Lebel
 * 
 */
@Named
@SessionScoped
public class InscriptionMBean implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4445950074774092185L;
	@EJB
	private UserEJB userEJB;
	@Inject
	private Logger log;
	private User user;
	private String form;
	private String include;

	public InscriptionMBean() {
	}

	public void changeForm() {
		if (form.contains("customerInscription")) {
			include = "/desktop/customerInscription.xhtml";
			user = new Customer();
		}

		else if (form.contains("managerInscription")) {
			include = "/desktop/managerInscription.xhtml";
			user = new Manager();
		}
		else if (form.contains("employeeInscription")) {
			include = "/desktop/employeeInscription.xhtml";
			user = new Employee();
		}
	}

	public void createUser() {

	}

	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user
	 *            the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * @return the form
	 */
	public String getForm() {
		return form;
	}

	/**
	 * @param form
	 *            the form to set
	 */
	public void setForm(String form) {
		this.form = form;
	}

	/**
	 * @return the include
	 */
	public String getInclude() {
		return include;
	}

	/**
	 * @param include
	 *            the include to set
	 */
	public void setInclude(String include) {
		this.include = include;
	}

}
